package com.lehecai.core.lottery.fetcher.lotterydraw.impl;

import com.lehecai.core.lottery.LotteryType;
import com.lehecai.core.lottery.fetcher.FetcherType;
import com.lehecai.core.lottery.fetcher.lotterydraw.LotteryDraw;
import com.lehecai.core.lottery.fetcher.lotterydraw.impl.worker.AbstractLotteryDrawFetchWorker;
import com.lehecai.core.lottery.fetcher.lotterydraw.impl.worker.LotteryDrawFetch562WorkerQihoo;
import com.lehecai.core.lottery.fetcher.lotterydraw.impl.worker.LotteryDrawFetch569Worker163;
import com.lehecai.core.lottery.fetcher.lotterydraw.impl.worker.LotteryDrawFetch569WorkerQihoo;
import com.lehecai.core.util.CoreFetcherUtils;

/**
 * Created by zhangzq on 14-8-11.
 */
public class LotteryDrawFetcher569 extends BaseLotteryDrawFetcher {

    private static final LotteryType lotteryType = LotteryType.HLJ11X5;

    protected LotteryDraw fetch163(String phase) {

        AbstractLotteryDrawFetchWorker fetchWorker = new LotteryDrawFetch569Worker163(lotteryType);
        LotteryDraw resultListObj = fetchWorker.fetchResult(phase);
        LotteryDraw resultDetailObj = fetchWorker.fetchResultDetail(phase);
        //如果传入的彩期没取得详情开奖信息 则提示未抓取成功
        if (resultDetailObj == null) {
            return null;
        }
        LotteryDraw returnObj = CoreFetcherUtils.getComparedResult(resultListObj, resultDetailObj);
        return returnObj;
    }

    public LotteryDraw fetchQihoo(String phase) {
        AbstractLotteryDrawFetchWorker fetchWorker = new LotteryDrawFetch569WorkerQihoo(lotteryType);
        return fetchWorker.fetchResultDetail(phase);
    }

    @Override
    protected FetcherType getDefaultFetcherType() {
        return FetcherType.T_163;
    }
}
